<TeXmacs|1.99.16>

<project|rehash.tm>

<style|<tuple|tmmanual|british>>

<\body>
  <subsection|Content-addressed source files>

  A relevant quote from the Guix manual:

  <\quote-env>
    As a bonus, <code*|guix publish> also serves as a content-addressed
    mirror for source files referenced in <scm|origin> records. \ For
    instance, assuming <code*|guix publish> is running on <samp|example.org>,
    the following URL returns the raw <samp|hello-2.10.tar.gz> file with the
    given SHA256 hash (represented in \<#2018\>nix-base32 format\<#2019\>):

    <\indent>
      <samp|http://example.org/file/hello-2.10.tar.gz/sha256/0ssi1...ndq1i>
    </indent>

    Obviously, these URLs only work for files that are in the store; in

    other cases, they return 404 (\PNot Found\Q).
  </quote-env>

  rehash-remirror can be used as a content-addressed mirror for files
  identified by their sha256 hash, which are referred to as
  <samp|/file/<var|arbitrary>/sha256/<var|nix-base32>>.

  <\problem>
    What does rehash-remirror fall-back to for content-addressed files?
  </problem>

  <subsection|Nix substitutes (including Guix)>

  Narfiles are more complicated to transparantly download via GNUnet FS. A
  first complication is that the \<#2018\>nix hash\<#2019\> in e.g.
  <samp|https://example.org/nar/gzip/<var|nixhash>-emacs-24.5> is based on
  the hashes of its inputs and build recipe (At least, if an extensional
  store is used instead of an intensional store. This is the case for Guix.).

  This is not an insurmountable problem though, as substitute servers publish
  a <samp|sha256> hash (or something similar in the future) hash for each
  substitute.

  \ Here's a Wireshark capture of <code*|guix challenge hello
  --substitute-urls=http://localhost:8080> (make sure <samp|guix publish> is
  running locally and build GNU hello first):

  <\quote-env>
    <\verbatim>
      GET /a462kby1q51ndvxdv3b6p0rsixxrgx1h.narinfo HTTP/1.1

      Host: localhost:8080

      User-Agent: GNU Guile

      \;

      HTTP/1.1 200 OK

      Content-Length: 974

      Content-Type: application/x-nix-narinfo;charset=utf-8

      \;

      StorePath: /gnu/store/a46[...]x1h-hello-2.10

      URL: nar/lzip/a46[...]x1h-hello-2.10

      Compression: lzip

      NarHash: sha256:1yl[...]qcw

      NarSize: 216832

      References: [...]

      Signature: [...]
    </verbatim>
  </quote-env>

  <\problem>
    Which substitute server should rehash\Uremirror ask for a narinfo?
  </problem>

  <\problem>
    What if multiple substitute servers have a narinfo, which one should be
    returned?
  </problem>

  <\problem>
    Could Guix support rehash-remirror returning multiple narinfos?
  </problem>

  <\exercise>
    Distribute the publishing of Narinfos. This is orthogonal to rehash and
    rehash-remirror. See the Guix mailing lists for some designs.
  </exercise>
</body>

<\initial>
  <\collection>
    <associate|page-medium|paper>
    <associate|save-aux|false>
  </collection>
</initial>